<template>
    <div class="parbox">
        <div class="box1">
            <img-form
              style="height:50vh"
              :zzPid="pid"
              :zhengZhaolx="zhengZhaolx"
              :editable="editable"
              @getImgs="getImgs"
            ></img-form>
        </div>
        <div class="box2">
            <a-button class="btn" style="marginRight:20px"  type="default"  @click="previous()">
                上一步
            </a-button>
            <a-button class="btn"  type="primary"  @click="nexts()">
                下一步
            </a-button>
        </div>
    </div>
</template>

<script>
import basicForm from '../common/basicForm'
import ImgForm from '../licenseImg/ImgForm'
import { addLicenseImg, getZZImgByzzpid,deleteLicenseImg} from '../licenseImg/licenseImg'

export default {
  props: {
    zzid: {
      type: Object,
    }
  },
  components: {
    basicForm,
    ImgForm
  },
  data() {
    return {
      pid:null,
      zhengZhaolx:null,
      editable:true,
      isSubmit:false,
    }
  },
  created(){

  },
  watch: {
    zzid: {
        handler: function (val, oldVal) {
            console.log(this.zzid);
            this.pid = this.zzid.zhengZhaotpPid
            this.zhengZhaolx=this.zzid.zhengZhaolx
        },
        deep: true,
        immediate:true
    }
  },
  mounted() {
    
  },
  methods: {
    getImgs(val){
      console.log(val);
      if(val>0){
        this.isSubmit=true
      }else{
        this.isSubmit=false
      }
    },
    nexts(){
        if(this.isSubmit){
          this.$message.success({ content: '保存成功',  duration: 3 })
          this.$emit('nextStep')
        }else{
          this.$message.warning({ content: '请添加证照图片',  duration: 3 })
        }
    },
    previous(){
      this.$emit("onCancel") 
    },
  },
}
</script>

<style scoped>
</style>